<template>
	<view>
		<view class="zxTcListPop">
			<view class="tcPopTit">优惠套餐推荐</view>
			<view class="smTcTit">如无法选择合适优惠套餐，请返回立即预约   单次预约></view>
			<view class="zxTcList">
				<scroll-view class="tcScroll" scroll-y>
					<view class="tcList"
						v-for="(item,index) in tcList"
						:key="index"
						@tap="goZxTcIntro(item)"
					>
						<view class="tcPrice spaceBet">
							<view class="tcTotal">共计<text class="tcNum">{{item.tcTimes}}</text>节次</view>
							<view class="tcMoneyBox hasFlex">
								<text class="tcUnit">¥</text>
								<view class="tcMoney">
									<template v-if="formatTcMoneyLen(item.tcMoney) == 1">
										{{item.tcMoney}}
									</template>
									<template v-else>
										<text>{{formatTcMoney(item.tcMoney)[0]}}</text>
										<text class="smTcMoney">.{{formatTcMoney(item.tcMoney)[1]}}</text>
									</template>
								</view>
							</view>
						</view>
						<view class="spaceBet alignCen">
							<view class="tcName">{{item.tcName}}</view>
							<view class="tcBuyBtn" @tap.stop="goBuyZxTc(item)">去购买</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		props:{
			tcList:Array
		},
		computed:{
			formatTcMoneyLen(){
				return function(tcMoney){
					let len = String(tcMoney).split(".").length;
					return len;
				}
			},
			formatTcMoney(){
				return function(tcMoney){
					let moneyArr = String(tcMoney).split(".");
					return moneyArr;
				}
			}
		},
		methods:{
			goZxTcIntro(item){
				this.$emit("goZxTcIntro",item)
			},
			goBuyZxTc(item){
				this.$emit("goBuyZxTc",item.id)
			}
		}
	}
</script>
<style src="@/static/fonts/staatliches.css"></style>
<style lang="scss" scoped>
	.zxTcListPop{
		border-radius: 40rpx 40rpx 0 0;
		background: #fff;
		padding: 50rpx 20rpx;
		height: 820rpx;
		.tcPopTit{
			font-size: 36rpx;
			color: #000;
			font-weight: 600;
		}
		.smTcTit{
			font-size: 24rpx;
			color: #666;
			margin: 15rpx 0 20rpx;
		}
		.zxTcList{
			height: calc(820rpx - 100rpx);
		}
		.tcScroll{
			height: 100%;
		}
		.tcList{
			padding: 20rpx;
			border-radius: 20rpx;
			background: #F7F8FA;
			margin-bottom: 20rpx;
			.tcPrice{
				margin-bottom: 15rpx;
				align-items: center;
			}
			.tcTotal{
				font-size:28rpx;
				color: #666;
			}
			.tcNum{
				color: #FF8D1A;
				margin: 0 5rpx;
				font-weight: 600;
			}
			.tcMoneyBox{
				color: #F75855;
				font-weight: 600;
				font-size: 40rpx;
				display: flex;
				align-items: center;
				.tcUnit{
					font-weight: normal;
					font-size: 26rpx;
					margin-right: 5rpx;
				}
				.tcMoney{
					font-family: $sqFontSta;
					.smTcMoney{
						font-size: 26rpx;
						margin-left: 5rpx;
					}
				}
			}
			.tcName{
				font-size: 32rpx;
				color: #000;
				font-weight: 600;
			}
			.tcBuyBtn{
				width: 120rpx;
				height: 48rpx;
				line-height: 48rpx;
				background: #02C396;
				border-radius: 50rpx;
				color: #fff;
				text-align: center;
				font-size:24rpx;
				flex-shrink: 0;
				margin-left: 20rpx;
			}
			&:last-child{
				margin-bottom: 0;
			}
		}
	}
</style>